package com.dhj.controller;

import com.dhj.baseBean.ResponseResult;
import com.dhj.entity.User;
import com.dhj.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DaHuaJia
 * @Description LoginController
 * @Date 2022-03-20 15:06:34
 */
@RestController
public class LoginController {


    @Autowired
    private LoginService loginService;


    /**
     * 重写登陆接口
     */
    @PostMapping("/user/login")
    public ResponseResult login(@RequestBody User user) {
        // 登录
        return loginService.login(user);
    }


    /**
     * 退出登录
     *
     * @return
     */
    @RequestMapping("/user/logout")
    public ResponseResult logout() {
        return loginService.logout();
    }

}
